/*
 * Created on Sat Sep 16 2017
 * @flow
 * Copyright (c) 2017 jianglinjie
 */
'use strict';

/* eslint-disable no-unused-vars*/

import type NetRequest from '../request/NetRequest';
import type _NetworkReponse from '../strategy/NetworkReponse';

export type ResponseVerifyResult = {
  error: any,
  ok: boolean,
};

export type ErrorHandleResult = {
  retry: boolean,
};

export type NetworkReponse = _NetworkReponse;

export interface NetHandler {
  injectExtraURLParam(request: NetRequest): Promise<Object>;
  injectExtraHeaders(request: NetRequest): Promise<Object>;
  verifyResponse(response: NetworkReponse): Promise<ResponseVerifyResult>;
  handleError(error: any, request: NetRequest): Promise<ErrorHandleResult>;
}